﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class article_MasterPage : System.Web.UI.MasterPage
{
    bool LoginStates = false;
    Cstudy.MODEL.users user = new Cstudy.MODEL.users();

    protected void Page_Load(object sender, EventArgs e)
    {
        GetLoginStates();
        NotLogin.Visible = !LoginStates;
        IsLogin.Visible = !NotLogin.Visible;
        LoginName.Text = user.UserName;
    }

    protected void GetLoginStates()
    {
        if (Request.Cookies["user"] != null)
        {
            HttpCookie cookies = Request.Cookies["user"];
            user.UserID = int.Parse(cookies.Values["userid"]);
            user.UserName = cookies.Values["name"];
            LoginStates = true;
            return;
        }
        LoginStates = false;
    }
}
